package com.bigdatastudio.api.Config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xiao_jie
 * @date 2022/11/7 19:57
 * @describe this is a text
 */

@Configuration
public class FileConfig implements WebMvcConfigurer {

    @Value("${reggie.path}")
    String folder;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + folder + "/");
        //Handler 访问路径  Locations  映射为真实路径
    }
}
